package com.zhz.common.tool.mybatisplus.base.dal.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 基础实体
 *
 * @author zhouhengzhe
 */
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@Data
public abstract class BasePO implements Serializable {
    private static final long serialVersionUID = 8243162602142898786L;

    /**
     * 雪花算法
     */
    @TableId(value = ID, type = IdType.ASSIGN_ID)
    private String id;

    @TableField(value = CREATE_TIME, fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @TableField(value = UPDATE_TIME, fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;

    @TableField(value = CREATOR, fill = FieldFill.INSERT)
    private String creator;

    @TableField(value = CREATOR_CODE, fill = FieldFill.INSERT)
    private String creatorCode;

    @TableField(value = UPDATER, fill = FieldFill.INSERT_UPDATE)
    private String updater;

    @TableField(value = UPDATER_CODE, fill = FieldFill.INSERT_UPDATE)
    private String updaterCode;

    @TableLogic(value = "1", delval = "0")
    @TableField(ACTIVE)
    private Integer active = 1;

    public static final String ID = "id";
    public static final String CREATE_TIME = "create_time";
    public static final String UPDATE_TIME = "update_time";
    public static final String CREATOR = "creator";
    public static final String CREATOR_CODE = "creator_code";
    public static final String UPDATER = "updater";
    public static final String UPDATER_CODE = "updater_code";
    public static final String ACTIVE = "active";
}